/*****************************************************
Copyright (C) 2020. All rights reserved.
File name     ：TestMain.c
Version       ：v1.0
Author        ：zhengqijun
Date          ：2020-04-03
Function List ：
Description   ：main function
******************************************************/

#include <stdio.h>  // for printf
#include "HashSep.h"

// main function
int main(void) {
    HashTable H;
    Position P;
    int i;

    H = InitializeTable(13);

    if (H == NULL) {
        printf("HashTable is empty!\n");
    } else {
        printf("HashTable is not empty!\n");
    }

    for (i = 1; i < 200; i += 3) {
        Insert(i, H);
    }

    printf("Print hash table:\n");
    PrintHashTable(H);
    printf("\n");

    P = Find(121, H);
    if (P != NULL) {
        printf("Find element 121 in hash table!\n");
    } else {
        printf("Can not find element 121 in hash table!\n");
    }

    P = Find(23, H);
    if (P != NULL) {
        printf("Find element 23 in hash table!\n");
    } else {
        printf("Can not find element 23 in hash table!\n");
    }

    Delete(55, H);
    printf("Delete element 55 in hash table!\n");

    Delete(22, H);
    printf("Delete element 22 in hash table!\n");

    printf("Print hash table:\n");
    PrintHashTable(H);
    printf("\n");

    DestroyTable(H);

    return 0;
}

// EOF

